package game;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;

public class Flappy {

	private Image image;

	private int x, y = 200, uy = 15, dy=0;

	Rectangle rectFlap;
	
	public Flappy(Image image) {

		this.image = image;

		rectFlap = new Rectangle(image.getWidth(null), image.getHeight(null));

	}
	

	public void render(Graphics g) {

		g.drawImage(image, x, y, null);

	}

	public void Startupdate(){
		
		x +=2;
		
	}
	
	public void update1() {
		
		if(dy < 20){
			
			dy += 2;
			y += dy;
			
		}else y += dy;
		
	}
	
	public int getUy() {
		return uy;
	}

	public void setUy(int uy) {
		this.uy = uy;
	}

	public int getDy() {
		return dy;
	}

	public void setDy(int dy) {
		this.dy = dy;
	}

	public void update2() {

		if(uy > 0){
			
			uy -= 1;
			y -= uy;
			
		}else y -= uy;
	}
	
	public Rectangle getArea(){
		
		rectFlap.x =x;
		rectFlap.y = y;
		rectFlap.width = image.getWidth(null);
		rectFlap.height = image.getHeight(null);
		return rectFlap;
		
	}


	public int getX() {
		return this.x;
	}


	public int getY() {
		return y;
	}


	public void setX(int x) {
		this.x = x;
	}


	public void setY(int y) {
		this.y = y;
	}
	
}
